<div nz-row class="mb20">
  <button nz-button nzType="primary" routerLink="/machine/new">添加主机</button>
</div>
<div nz-row>
  <nz-table #basicTable [nzData]="result.list" [nzFrontPagination]="false" [nzHideOnSinglePage]="true"
            [nzSimple]="true"
            [nzTotal]="result.count" [nzPageIndex]="result.page" [nzPageSize]="result.size"
            (nzPageIndexChange)="pageChange($event)">
    <thead (nzSortChange)="sort($event)">
    <tr>
      <th nzShowSort nzSortKey="remark">备注</th>
      <th>地址</th>
      <th>端口</th>
      <th>用户名</th>
      <th nzShowSort nzSortKey="createTime">创建时间</th>
      <th nzShowSort nzSortKey="updateTime">修改时间</th>
      <th>Action</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>        {{ data.remark }}      </td>
      <td>{{ data.host }}</td>
      <td>{{ data.port }}</td>
      <td>{{ data.username }}</td>
      <td>{{ data.createTime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
      <td>{{ data.updateTime | date:'yyyy-MM-dd HH:mm:ss' }}</td>
      <td>
        <a [routerLink]="'/machine/operation/'+data.id">
          操作
        </a>
        <nz-divider nzType="vertical"></nz-divider>
        <a (click)="resetVisible = true; newPassword = ''; id = data.id">重置密码</a>
        <nz-divider nzType="vertical"></nz-divider>
        <a [routerLink]="'/machine/edit/'+data.id">编辑</a>
        <nz-divider nzType="vertical"></nz-divider>
        <a nz-popconfirm nzPopconfirmTitle="确认删除该项目吗?" (nzOnConfirm)="deleteConfirm(data.id)">删除</a>
      </td>
    </tr>
    </tbody>
  </nz-table>
</div>

<nz-modal [(nzVisible)]="resetVisible" nzTitle="重置密码" (nzOnCancel)="resetVisible=false" (nzOnOk)="resetSubmit()" nzMaskClosable="false">
  <input nz-input [(ngModel)]="newPassword" type="password" placeholder="请输入密码"/>
</nz-modal>
